// InitWnd.cpp : implementation file
//

#include "stdafx.h"
#include "VISUAL ASM.h"
#include "InitWnd.h"


// CInitWnd

IMPLEMENT_DYNAMIC(CInitWnd, CWnd)

CInitWnd::CInitWnd()
{

}

CInitWnd::~CInitWnd()
{
}


BEGIN_MESSAGE_MAP(CInitWnd, CWnd)
	ON_WM_CREATE()
	ON_WM_PAINT()
END_MESSAGE_MAP()



// CInitWnd message handlers



int CInitWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CWnd::OnCreate(lpCreateStruct) == -1)
		return -1;
	// TODO:  Add your specialized creation code here

	return 0;
}

void CInitWnd::Create()
{
	m_bitmap.LoadBitmapEx(IDB_BITMAP_INIT, FALSE);
	int iX = (GetSystemMetrics(SM_CXSCREEN) - m_bitmap.GetWidth()) / 2;
	int iY = (GetSystemMetrics(SM_CYSCREEN) - m_bitmap.GetHeight()) / 2;
	CRect rect(iX, iY, iX + m_bitmap.GetWidth(), iY + m_bitmap.GetHeight());
	this->CreateEx(0,  ::AfxRegisterWndClass(0), L"", WS_POPUP | WS_BORDER | WS_VISIBLE, rect, 0, 0);
}
void CInitWnd::OnPaint()
{
	CPaintDC dc(this); // device context for painting
	// TODO: Add your message handler code here
	// Do not call CWnd::OnPaint() for painting messages
	CPalette *pOldPalette = dc.SelectPalette(m_bitmap.GetPalette(), FALSE);
	dc.RealizePalette();
	CDC dcNew;
	dcNew.CreateCompatibleDC(&dc);
	dcNew.SelectObject(&m_bitmap);
	dc.BitBlt(0, 0, m_bitmap.GetWidth(), m_bitmap.GetHeight(), &dcNew, 0, 0, SRCCOPY);
	::Sleep(2000);
	dc.SelectPalette(pOldPalette, FALSE);
}
